bitkeeper revision 1.105 (3e5cfaa1sTwHu-8MSxs6PpY5y9101Q)
authorkaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk>
Wed, 26 Feb 2003 17:34:25 +0000 (17:34 +0000)
committerkaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk>
Wed, 26 Feb 2003 17:34:25 +0000 (17:34 +0000)
network.c, dev.c:
  Add compiler barriers to ensure descriptor updates occur before index updates in network code.

xen/net/dev.c
xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c

index 25aa35fd78b364fa2588c43d1f821b3c73592ffa..0bf8125014680ff3e784cc1e7139832e4e290afd 100644 (file)
@@ -533,6 +533,7 @@ void deliver_packet(struct sk_buff *skb, net_vif_t *vif)
     skb->pf = g_pfn;
 
  inc_and_out:        
+    smp_wmb(); /* updates must happen before releasing the descriptor. */
     shadow_ring->rx_idx = RX_RING_INC(i);
 }
 
@@ -681,6 +682,8 @@ static void tx_skb_release(struct sk_buff *skb)
      * mutual exclusion from do_IRQ().
      */
 
+    smp_wmb(); /* make sure any status updates occur before inc'ing tx_cons. */
+
     /* Skip over a sequence of bad descriptors, plus the first good one. */
     do {
         idx = vif->shadow_ring->tx_cons;
@@ -826,6 +829,7 @@ void update_shared_ring(void)
             if ( rx->flush_count == tlb_flush_count[smp_processor_id()] )
                 __flush_tlb();
 
+            smp_wmb(); /* copy descriptor before inc'ing rx_cons */
             shadow_ring->rx_cons = RX_RING_INC(shadow_ring->rx_cons);
 
             if ( shadow_ring->rx_cons == net_ring->rx_event )
index 8e742007cf478a2938125a818643f5e2042d5503..c9acaf43eec7de8f36545146f1ef00fadd477e29 100644 (file)
@@ -293,7 +293,7 @@ static void network_rx_int(int irq, void *dev_id, struct pt_regs *ptregs)
     {
         if (np->net_ring->rx_ring[i].status != RING_STATUS_OK)
         {
-            printk("bad buffer on RX ring!(%d)\n", 
+            printk(KERN_ALERT "bad buffer on RX ring!(%d)\n", 
                    np->net_ring->rx_ring[i].status);
             continue;
         }